const { ccclass, property } = cc._decorator;

@ccclass
export default class shadowRender2D extends cc.Component {

    private shadowItem:cc.Node;
    private shadowObj:cc.Node;

    start() {
        this.shadowItem = this.node.getChildByName("shadowItem");
        if(!this.shadowItem) return;
        this.shadowObj = cc.instantiate(this.shadowItem);
        this.shadowObj.parent = cc.find("Canvas/gounrdLayer");
        this.shadowItem.active = false;
    }

    update(dt) {
        if(!this.shadowObj) return;
        this.shadowObj.setPosition(this.node.position);
    }

    onDestroy(){
        this.shadowObj.destroy();
    }
}
